#include<bits/stdc++.h>
#define ll long long
#define int ll
#define L x<<1
#define R x<<1|1
#define mid ((l+r)>>1)
#define lc L,l,mid
#define rc R,mid+1,r
#define Root 1,1,n-1
#define OK Ll<=l&&r<=Rr
#define rep(x,y,z) for(int x=(y);x<=(z);x++)
#define per(x,y,z) for(int x=(y);x>=(z);x--)
#define repn(x) rep(x,1,n)
#define repm(x) rep(x,1,m)
#define pb push_back
#define e(x) for(int i=h[x],y=to[i];i;i=nxt[i],y=to[i])
#define E(x) for(auto y:p[x])
#define Pi pair<int,int>
#define ui unsigned ll
inline int read(){int s=0,w=1;char c=getchar();while(c<48||c>57) {if(c=='-') w=-1;c=getchar();}while(c>=48&&c<=57)s=(s<<1)+(s<<3)+c-48,c=getchar();return s*w;}
inline void pf(ll x){if(x<0) putchar('-'),x=-x;if(x>9)pf(x/10);putchar(x%10+48);}
using namespace std;
const int N=5e5+5,M=1e7+5,inf=(1LL<<29)-1,mod=998244353;
const ll llf=1e18;
inline void add(int &a,int b){((a+=b)>=mod) and (a-=mod);}
inline int Add(int a,int b){return add(a,b),a;}
inline int mul(int a,int b){return 1LL*a*b%mod;}
inline void Mul(int &a,int b){a=mul(a,b);}
inline void red(int &a,int b){add(a,mod-b);}
inline int Red(int a,int b){return red(a,b),a;}
inline int qp(int a,ll b){if(!b)return 1;int c=qp(a,b>>1LL);Mul(c,c);if(b&1)Mul(c,a);return c;}
inline int INV(int x){return qp(x,mod-2);}
int k,m;
inline bool check(int A1,int D1,int A2,int D2){//2可以选择继续拆盾
	if(A1<=D2*k)return 0;
	rep(i,0,D1){
		int A=A1,B=D1,C=A2,D=D2;
		B-=i,C-=(A-D*k)*i;
		if(C<=0)continue;
		if(C<=B*k)continue;
		bool nw=1;
		while(1){
			if(nw==1){
				int W=A-D*k;
				if(W<=0)return 0;
				C-=W,nw^=1;
			}else{
				int W=C-B*k;
				if(W<=0)break;
				A-=W,nw^=1;
			}
			if(A<=0)return 0;
			if(C<=0)break;
		}
	}
	return 1;
}
inline void subtask3(){
	repm(i){
		int ha=read(),na=read(),hb=read(),nb=read();
		if(ha>=nb&&hb<=na){
			puts("YES");
			continue;
		}
		if(ha<=nb&&hb>na){
			puts("NO");
			continue;
		}
		if(ha>nb){
			//互殴开始！
			bool nw=1;
			ha-=nb,hb-=na;
			while(1){
				if(hb<=0){
					puts("YES");
					break;
				}
				if(ha<=0){
					puts("NO");
					break;
				}
				if(nw)hb-=ha;
				else ha-=hb;
				if(hb<=0){
					puts("YES");
					break;
				}
				if(ha<=0){
					puts("NO");
					break;
				}
				nw^=1;
			}
			continue;
		}
		int W=min(nb-ha+1,na-hb+1);
		nb-=W,na-=W;
		if(ha>=nb&&hb<=na){
			puts("YES");
			continue;
		}
		if(ha<=nb&&hb>na){
			puts("NO");
			continue;
		}
		if(ha>nb){
			//互殴开始！
			bool nw=1;
			ha-=nb,hb-=na;
			while(1){
				if(hb<=0){
					puts("YES");
					break;
				}
				if(ha<=0){
					puts("NO");
					break;
				}
				if(nw)hb-=ha;
				else ha-=hb;
				if(hb<=0){
					puts("YES");
					break;
				}
				if(ha<=0){
					puts("NO");
					break;
				}
				nw^=1;
			}
			continue;
		}
	}
}
inline bool solve(int A,int B,int C,int D){
	if(A<=0)return 0;
	if(C<=0)return 1;
	int NdA=A/k,NdC=C/k;//D<=NdA 才有用
	int del=min(D-NdA,B-NdC);
	del=max(del,0LL);
	B-=del,D-=del;
	int ata=max(0LL,A-D*k),atb=max(0LL,C-B*k);
	if(!D)return !solve(C-ata,D,A,B);
	if(ata>=C)return 1;
	if(!ata)return !solve(C,D-1,A,B);
	if(atb>=k)return !solve(C-ata,D,A,B);
	if(ata>=k)return 1;
	if(ata>=atb)return 1;
	if(ata*2<=atb&&B)return solve(A-atb,B,C,D-1);
	// if(ata*2<=atb)return 0;
	return solve(A-atb,B,C,D-1)||!solve(C-ata,D,A,B);
}
inline void subtask6(){
	repm(i){
		int ha=read(),na=read(),hb=read(),nb=read();
		bool nw=0;
		puts(solve(ha,na,hb,nb)?"YES":"NO");
		continue;
		while(1){
			if(nw==0){
				if(check(ha,na,hb,nb)){puts("YES");break;}
				if(!nb){
					puts("NO");
					break;
				}
				nb--,nw^=1;
			}else {
				if(check(hb,nb,ha,na)){puts("NO");break;}
				if(!na){
					puts("YES");
					break;
				}
				na--,nw^=1;
			}
		}
	}
}
inline void Main(){
	k=read(),m=read();
	if(k==1)return subtask3(),void();
	return subtask6(),void();
}
signed main(){
	freopen("game.in","r",stdin);
	freopen("game.out","w",stdout);
	int T=1;
	while(T--)Main();
	return 0;
}